class ScoresController < ApplicationController
  skip_before_action :verify_authenticity_token
  layout "grade_layout"
  def index
  end
  def show
    redirect_to scores_url
  end
  def get_score_list
    @license_key = params[:license]
    # #这个地方需要把密码条放到session里面
    license = License.where("content = ? and is_used = 0", @license_key)
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      if license.first.license_type == 1
        ###青投中层给中层打分
        render "employee"
      elsif license.first.license_type == 2 
        ###青投中层给一般员工打分
        render "employee2"
      elsif license.first.license_type == 3
        ###青投一般员工给中层打分
        render "employee3"
      elsif license.first.license_type == 4
        ###青投一般员工给一般员工打分
        render "employee4"
      elsif license.first.license_type == 5
        ###保税港中层给中层打分
        render "employee5"
      elsif license.first.license_type == 7
        ###保税港一般员工给中层打分
        render "employee7"
      elsif license.first.license_type == 9
        ###刘虹B票
        render "employee9"
      elsif license.first.license_type == 11
        ###刘虹C1
        render "employee11"
      elsif license.first.license_type == 12
        ###刘虹C2
        render "employee12"
      elsif license.first.license_type == 13
        ###分中给中层打分
        render "employee13"
      elsif license.first.license_type == 16
        ###分一般员工给一般员工打分
        render "employee16"
      elsif license.first.license_type == 17
        ###分一般员工给一般员工打分
        render "employee17"
      else
        redirect_to scores_url, notice: '密码条已使用或无效密码条'
      end     
    end
  end
  def post_employee
  end
  def post_team_socre
  end
  def save_employee_score
    ####投资发展部4个中层给中层打分
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_01 = Score.new
      score_01.entity_type = 1
      score_01.entity_id = 1
      score_01.daode = params["daode_01"]
      score_01.zhiye = params["zhiye_01"]
      score_01.zhixing = params["zhixing_01"]
      score_01.xuexi = params["xuexi_01"]
      score_01.chuangxin = params["chuangxin_01"]
      score_01.goutong = params["goutong_01"]
      score_01.license_id = license.first.id
      score_01.created_at = Time.now
      score_01.updated_at = Time.now
      score_01.save
      score_02 = Score.new
      score_02.entity_type = 1
      score_02.entity_id = 2
      score_02.daode = params["daode_02"]
      score_02.zhiye = params["zhiye_02"]
      score_02.zhixing = params["zhixing_02"]
      score_02.xuexi = params["xuexi_02"]
      score_02.chuangxin = params["chuangxin_02"]
      score_02.goutong = params["goutong_02"]
      score_02.license_id = license.first.id
      score_02.created_at = Time.now
      score_02.updated_at = Time.now
      score_02.save
      score_03 = Score.new
      score_03.entity_type = 1
      score_03.entity_id = 3
      score_03.daode = params["daode_03"]
      score_03.zhiye = params["zhiye_03"]
      score_03.zhixing = params["zhixing_03"]
      score_03.xuexi = params["xuexi_03"]
      score_03.chuangxin = params["chuangxin_03"]
      score_03.goutong = params["goutong_03"]
      score_03.license_id = license.first.id
      score_03.created_at = Time.now
      score_03.updated_at = Time.now
      score_03.save
      score_04 = Score.new
      score_04.entity_type = 1
      score_04.entity_id = 4
      score_04.daode = params["daode_04"]
      score_04.zhiye = params["zhiye_04"]
      score_04.zhixing = params["zhixing_04"]
      score_04.xuexi = params["xuexi_04"]
      score_04.chuangxin = params["chuangxin_04"]
      score_04.goutong = params["goutong_04"]
      score_04.license_id = license.first.id
      score_04.created_at = Time.now
      score_04.updated_at = Time.now
      score_04.save
      score_05 = Score.new
      score_05.entity_type = 1
      score_05.entity_id = 5
      score_05.daode = params["daode_05"]
      score_05.zhiye = params["zhiye_05"]
      score_05.zhixing = params["zhixing_05"]
      score_05.xuexi = params["xuexi_05"]
      score_05.chuangxin = params["chuangxin_05"]
      score_05.goutong = params["goutong_05"]
      score_05.license_id = license.first.id
      score_05.created_at = Time.now
      score_05.updated_at = Time.now
      score_05.save
      score_06 = Score.new
      score_06.entity_type = 1
      score_06.entity_id = 6
      score_06.daode = params["daode_06"]
      score_06.zhiye = params["zhiye_06"]
      score_06.zhixing = params["zhixing_06"]
      score_06.xuexi = params["xuexi_06"]
      score_06.chuangxin = params["chuangxin_06"]
      score_06.goutong = params["goutong_06"]
      score_06.license_id = license.first.id
      score_06.created_at = Time.now
      score_06.updated_at = Time.now
      score_06.save
      score_07 = Score.new
      score_07.entity_type = 1
      score_07.entity_id = 7
      score_07.daode = params["daode_07"]
      score_07.zhiye = params["zhiye_07"]
      score_07.zhixing = params["zhixing_07"]
      score_07.xuexi = params["xuexi_07"]
      score_07.chuangxin = params["chuangxin_07"]
      score_07.goutong = params["goutong_07"]
      score_07.license_id = license.first.id
      score_07.created_at = Time.now
      score_07.updated_at = Time.now
      score_07.save
      score_08 = Score.new
      score_08.entity_type = 1
      score_08.entity_id = 8
      score_08.daode = params["daode_08"]
      score_08.zhiye = params["zhiye_08"]
      score_08.zhixing = params["zhixing_08"]
      score_08.xuexi = params["xuexi_08"]
      score_08.chuangxin = params["chuangxin_08"]
      score_08.goutong = params["goutong_08"]
      score_08.license_id = license.first.id
      score_08.created_at = Time.now
      score_08.updated_at = Time.now
      score_08.save
      score_09 = Score.new
      score_09.entity_type = 1
      score_09.entity_id = 9
      score_09.daode = params["daode_09"]
      score_09.zhiye = params["zhiye_09"]
      score_09.zhixing = params["zhixing_09"]
      score_09.xuexi = params["xuexi_09"]
      score_09.chuangxin = params["chuangxin_09"]
      score_09.goutong = params["goutong_09"]
      score_09.license_id = license.first.id
      score_09.created_at = Time.now
      score_09.updated_at = Time.now
      score_09.save
      score_10 = Score.new
      score_10.entity_type = 1
      score_10.entity_id = 10
      score_10.daode = params["daode_10"]
      score_10.zhiye = params["zhiye_10"]
      score_10.zhixing = params["zhixing_10"]
      score_10.xuexi = params["xuexi_10"]
      score_10.chuangxin = params["chuangxin_10"]
      score_10.goutong = params["goutong_10"]
      score_10.license_id = license.first.id
      score_10.created_at = Time.now
      score_10.updated_at = Time.now
      score_10.save    
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score2
    ####投资发展部4个中层给一般员工打分
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_24 = Score.new
      score_24.entity_type = 1
      score_24.entity_id = 24
      score_24.daode = params["daode_24"]
      score_24.zhiye = params["zhiye_24"]
      score_24.zhixing = params["zhixing_24"]
      score_24.xuexi = params["xuexi_24"]
      score_24.chuangxin = params["chuangxin_24"]
      score_24.goutong = params["goutong_24"]
      score_24.license_id = license.first.id
      score_24.created_at = Time.now
      score_24.updated_at = Time.now
      score_24.save
      score_25 = Score.new
      score_25.entity_type = 1
      score_25.entity_id = 25
      score_25.daode = params["daode_25"]
      score_25.zhiye = params["zhiye_25"]
      score_25.zhixing = params["zhixing_25"]
      score_25.xuexi = params["xuexi_25"]
      score_25.chuangxin = params["chuangxin_25"]
      score_25.goutong = params["goutong_25"]
      score_25.license_id = license.first.id
      score_25.created_at = Time.now
      score_25.updated_at = Time.now
      score_25.save
      score_26 = Score.new
      score_26.entity_type = 1
      score_26.entity_id = 26
      score_26.daode = params["daode_26"]
      score_26.zhiye = params["zhiye_26"]
      score_26.zhixing = params["zhixing_26"]
      score_26.xuexi = params["xuexi_26"]
      score_26.chuangxin = params["chuangxin_26"]
      score_26.goutong = params["goutong_26"]
      score_26.license_id = license.first.id
      score_26.created_at = Time.now
      score_26.updated_at = Time.now
      score_26.save
      score_27 = Score.new
      score_27.entity_type = 1
      score_27.entity_id = 27
      score_27.daode = params["daode_27"]
      score_27.zhiye = params["zhiye_27"]
      score_27.zhixing = params["zhixing_27"]
      score_27.xuexi = params["xuexi_27"]
      score_27.chuangxin = params["chuangxin_27"]
      score_27.goutong = params["goutong_27"]
      score_27.license_id = license.first.id
      score_27.created_at = Time.now
      score_27.updated_at = Time.now
      score_27.save
      score_28 = Score.new
      score_28.entity_type = 1
      score_28.entity_id = 28
      score_28.daode = params["daode_28"]
      score_28.zhiye = params["zhiye_28"]
      score_28.zhixing = params["zhixing_28"]
      score_28.xuexi = params["xuexi_28"]
      score_28.chuangxin = params["chuangxin_28"]
      score_28.goutong = params["goutong_28"]
      score_28.license_id = license.first.id
      score_28.created_at = Time.now
      score_28.updated_at = Time.now
      score_28.save
      score_29 = Score.new
      score_29.entity_type = 1
      score_29.entity_id = 29
      score_29.daode = params["daode_29"]
      score_29.zhiye = params["zhiye_29"]
      score_29.zhixing = params["zhixing_29"]
      score_29.xuexi = params["xuexi_29"]
      score_29.chuangxin = params["chuangxin_29"]
      score_29.goutong = params["goutong_29"]
      score_29.license_id = license.first.id
      score_29.created_at = Time.now
      score_29.updated_at = Time.now
      score_29.save
      score_30 = Score.new
      score_30.entity_type = 1
      score_30.entity_id = 30
      score_30.daode = params["daode_30"]
      score_30.zhiye = params["zhiye_30"]
      score_30.zhixing = params["zhixing_30"]
      score_30.xuexi = params["xuexi_30"]
      score_30.chuangxin = params["chuangxin_30"]
      score_30.goutong = params["goutong_30"]
      score_30.license_id = license.first.id
      score_30.created_at = Time.now
      score_30.updated_at = Time.now
      score_30.save
      score_31 = Score.new
      score_31.entity_type = 1
      score_31.entity_id = 31
      score_31.daode = params["daode_31"]
      score_31.zhiye = params["zhiye_31"]
      score_31.zhixing = params["zhixing_31"]
      score_31.xuexi = params["xuexi_31"]
      score_31.chuangxin = params["chuangxin_31"]
      score_31.goutong = params["goutong_31"]
      score_31.license_id = license.first.id
      score_31.created_at = Time.now
      score_31.updated_at = Time.now
      score_31.save
      score_32 = Score.new
      score_32.entity_type = 1
      score_32.entity_id = 32
      score_32.daode = params["daode_32"]
      score_32.zhiye = params["zhiye_32"]
      score_32.zhixing = params["zhixing_32"]
      score_32.xuexi = params["xuexi_32"]
      score_32.chuangxin = params["chuangxin_32"]
      score_32.goutong = params["goutong_32"]
      score_32.license_id = license.first.id
      score_32.created_at = Time.now
      score_32.updated_at = Time.now
      score_32.save
      score_33 = Score.new
      score_33.entity_type = 1
      score_33.entity_id = 33
      score_33.daode = params["daode_33"]
      score_33.zhiye = params["zhiye_33"]
      score_33.zhixing = params["zhixing_33"]
      score_33.xuexi = params["xuexi_33"]
      score_33.chuangxin = params["chuangxin_33"]
      score_33.goutong = params["goutong_33"]
      score_33.license_id = license.first.id
      score_33.created_at = Time.now
      score_33.updated_at = Time.now
      score_33.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score3
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_01 = Score.new
      score_01.entity_type = 1
      score_01.entity_id = 1
      score_01.daode = params["daode_01"]
      score_01.zhiye = params["zhiye_01"]
      score_01.zhixing = params["zhixing_01"]
      score_01.xuexi = params["xuexi_01"]
      score_01.chuangxin = params["chuangxin_01"]
      score_01.goutong = params["goutong_01"]
      score_01.license_id = license.first.id
      score_01.created_at = Time.now
      score_01.updated_at = Time.now
      score_01.save
      score_02 = Score.new
      score_02.entity_type = 1
      score_02.entity_id = 2
      score_02.daode = params["daode_02"]
      score_02.zhiye = params["zhiye_02"]
      score_02.zhixing = params["zhixing_02"]
      score_02.xuexi = params["xuexi_02"]
      score_02.chuangxin = params["chuangxin_02"]
      score_02.goutong = params["goutong_02"]
      score_02.license_id = license.first.id
      score_02.created_at = Time.now
      score_02.updated_at = Time.now
      score_02.save
      score_03 = Score.new
      score_03.entity_type = 1
      score_03.entity_id = 3
      score_03.daode = params["daode_03"]
      score_03.zhiye = params["zhiye_03"]
      score_03.zhixing = params["zhixing_03"]
      score_03.xuexi = params["xuexi_03"]
      score_03.chuangxin = params["chuangxin_03"]
      score_03.goutong = params["goutong_03"]
      score_03.license_id = license.first.id
      score_03.created_at = Time.now
      score_03.updated_at = Time.now
      score_03.save
      score_04 = Score.new
      score_04.entity_type = 1
      score_04.entity_id = 4
      score_04.daode = params["daode_04"]
      score_04.zhiye = params["zhiye_04"]
      score_04.zhixing = params["zhixing_04"]
      score_04.xuexi = params["xuexi_04"]
      score_04.chuangxin = params["chuangxin_04"]
      score_04.goutong = params["goutong_04"]
      score_04.license_id = license.first.id
      score_04.created_at = Time.now
      score_04.updated_at = Time.now
      score_04.save
      score_05 = Score.new
      score_05.entity_type = 1
      score_05.entity_id = 5
      score_05.daode = params["daode_05"]
      score_05.zhiye = params["zhiye_05"]
      score_05.zhixing = params["zhixing_05"]
      score_05.xuexi = params["xuexi_05"]
      score_05.chuangxin = params["chuangxin_05"]
      score_05.goutong = params["goutong_05"]
      score_05.license_id = license.first.id
      score_05.created_at = Time.now
      score_05.updated_at = Time.now
      score_05.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score4
    ####投资发展部4个中层给一般员工打分
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_24 = Score.new
      score_24.entity_type = 1
      score_24.entity_id = 24
      score_24.daode = params["daode_24"]
      score_24.zhiye = params["zhiye_24"]
      score_24.zhixing = params["zhixing_24"]
      score_24.xuexi = params["xuexi_24"]
      score_24.chuangxin = params["chuangxin_24"]
      score_24.goutong = params["goutong_24"]
      score_24.license_id = license.first.id
      score_24.created_at = Time.now
      score_24.updated_at = Time.now
      score_24.save
      score_25 = Score.new
      score_25.entity_type = 1
      score_25.entity_id = 25
      score_25.daode = params["daode_25"]
      score_25.zhiye = params["zhiye_25"]
      score_25.zhixing = params["zhixing_25"]
      score_25.xuexi = params["xuexi_25"]
      score_25.chuangxin = params["chuangxin_25"]
      score_25.goutong = params["goutong_25"]
      score_25.license_id = license.first.id
      score_25.created_at = Time.now
      score_25.updated_at = Time.now
      score_25.save
      score_26 = Score.new
      score_26.entity_type = 1
      score_26.entity_id = 26
      score_26.daode = params["daode_26"]
      score_26.zhiye = params["zhiye_26"]
      score_26.zhixing = params["zhixing_26"]
      score_26.xuexi = params["xuexi_26"]
      score_26.chuangxin = params["chuangxin_26"]
      score_26.goutong = params["goutong_26"]
      score_26.license_id = license.first.id
      score_26.created_at = Time.now
      score_26.updated_at = Time.now
      score_26.save
      score_27 = Score.new
      score_27.entity_type = 1
      score_27.entity_id = 27
      score_27.daode = params["daode_27"]
      score_27.zhiye = params["zhiye_27"]
      score_27.zhixing = params["zhixing_27"]
      score_27.xuexi = params["xuexi_27"]
      score_27.chuangxin = params["chuangxin_27"]
      score_27.goutong = params["goutong_27"]
      score_27.license_id = license.first.id
      score_27.created_at = Time.now
      score_27.updated_at = Time.now
      score_27.save
      score_28 = Score.new
      score_28.entity_type = 1
      score_28.entity_id = 28
      score_28.daode = params["daode_28"]
      score_28.zhiye = params["zhiye_28"]
      score_28.zhixing = params["zhixing_28"]
      score_28.xuexi = params["xuexi_28"]
      score_28.chuangxin = params["chuangxin_28"]
      score_28.goutong = params["goutong_28"]
      score_28.license_id = license.first.id
      score_28.created_at = Time.now
      score_28.updated_at = Time.now
      score_28.save
      score_29 = Score.new
      score_29.entity_type = 1
      score_29.entity_id = 29
      score_29.daode = params["daode_29"]
      score_29.zhiye = params["zhiye_29"]
      score_29.zhixing = params["zhixing_29"]
      score_29.xuexi = params["xuexi_29"]
      score_29.chuangxin = params["chuangxin_29"]
      score_29.goutong = params["goutong_29"]
      score_29.license_id = license.first.id
      score_29.created_at = Time.now
      score_29.updated_at = Time.now
      score_29.save
      score_30 = Score.new
      score_30.entity_type = 1
      score_30.entity_id = 30
      score_30.daode = params["daode_30"]
      score_30.zhiye = params["zhiye_30"]
      score_30.zhixing = params["zhixing_30"]
      score_30.xuexi = params["xuexi_30"]
      score_30.chuangxin = params["chuangxin_30"]
      score_30.goutong = params["goutong_30"]
      score_30.license_id = license.first.id
      score_30.created_at = Time.now
      score_30.updated_at = Time.now
      score_30.save
      score_31 = Score.new
      score_31.entity_type = 1
      score_31.entity_id = 31
      score_31.daode = params["daode_31"]
      score_31.zhiye = params["zhiye_31"]
      score_31.zhixing = params["zhixing_31"]
      score_31.xuexi = params["xuexi_31"]
      score_31.chuangxin = params["chuangxin_31"]
      score_31.goutong = params["goutong_31"]
      score_31.license_id = license.first.id
      score_31.created_at = Time.now
      score_31.updated_at = Time.now
      score_31.save
      score_32 = Score.new
      score_32.entity_type = 1
      score_32.entity_id = 32
      score_32.daode = params["daode_32"]
      score_32.zhiye = params["zhiye_32"]
      score_32.zhixing = params["zhixing_32"]
      score_32.xuexi = params["xuexi_32"]
      score_32.chuangxin = params["chuangxin_32"]
      score_32.goutong = params["goutong_32"]
      score_32.license_id = license.first.id
      score_32.created_at = Time.now
      score_32.updated_at = Time.now
      score_32.save
      score_33 = Score.new
      score_33.entity_type = 1
      score_33.entity_id = 33
      score_33.daode = params["daode_33"]
      score_33.zhiye = params["zhiye_33"]
      score_33.zhixing = params["zhixing_33"]
      score_33.xuexi = params["xuexi_33"]
      score_33.chuangxin = params["chuangxin_33"]
      score_33.goutong = params["goutong_33"]
      score_33.license_id = license.first.id
      score_33.created_at = Time.now
      score_33.updated_at = Time.now
      score_33.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score5
    ####投资发展部4个中层给中层打分
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_01 = Score.new
      score_01.entity_type = 1
      score_01.entity_id = 1
      score_01.daode = params["daode_01"]
      score_01.zhiye = params["zhiye_01"]
      score_01.zhixing = params["zhixing_01"]
      score_01.xuexi = params["xuexi_01"]
      score_01.chuangxin = params["chuangxin_01"]
      score_01.goutong = params["goutong_01"]
      score_01.license_id = license.first.id
      score_01.created_at = Time.now
      score_01.updated_at = Time.now
      score_01.save
      score_02 = Score.new
      score_02.entity_type = 1
      score_02.entity_id = 2
      score_02.daode = params["daode_02"]
      score_02.zhiye = params["zhiye_02"]
      score_02.zhixing = params["zhixing_02"]
      score_02.xuexi = params["xuexi_02"]
      score_02.chuangxin = params["chuangxin_02"]
      score_02.goutong = params["goutong_02"]
      score_02.license_id = license.first.id
      score_02.created_at = Time.now
      score_02.updated_at = Time.now
      score_02.save
      score_03 = Score.new
      score_03.entity_type = 1
      score_03.entity_id = 3
      score_03.daode = params["daode_03"]
      score_03.zhiye = params["zhiye_03"]
      score_03.zhixing = params["zhixing_03"]
      score_03.xuexi = params["xuexi_03"]
      score_03.chuangxin = params["chuangxin_03"]
      score_03.goutong = params["goutong_03"]
      score_03.license_id = license.first.id
      score_03.created_at = Time.now
      score_03.updated_at = Time.now
      score_03.save
      score_04 = Score.new
      score_04.entity_type = 1
      score_04.entity_id = 4
      score_04.daode = params["daode_04"]
      score_04.zhiye = params["zhiye_04"]
      score_04.zhixing = params["zhixing_04"]
      score_04.xuexi = params["xuexi_04"]
      score_04.chuangxin = params["chuangxin_04"]
      score_04.goutong = params["goutong_04"]
      score_04.license_id = license.first.id
      score_04.created_at = Time.now
      score_04.updated_at = Time.now
      score_04.save
      score_06 = Score.new
      score_06.entity_type = 1
      score_06.entity_id = 6
      score_06.daode = params["daode_06"]
      score_06.zhiye = params["zhiye_06"]
      score_06.zhixing = params["zhixing_06"]
      score_06.xuexi = params["xuexi_06"]
      score_06.chuangxin = params["chuangxin_06"]
      score_06.goutong = params["goutong_06"]
      score_06.license_id = license.first.id
      score_06.created_at = Time.now
      score_06.updated_at = Time.now
      score_06.save
      score_07 = Score.new
      score_07.entity_type = 1
      score_07.entity_id = 7
      score_07.daode = params["daode_07"]
      score_07.zhiye = params["zhiye_07"]
      score_07.zhixing = params["zhixing_07"]
      score_07.xuexi = params["xuexi_07"]
      score_07.chuangxin = params["chuangxin_07"]
      score_07.goutong = params["goutong_07"]
      score_07.license_id = license.first.id
      score_07.created_at = Time.now
      score_07.updated_at = Time.now
      score_07.save
      score_08 = Score.new
      score_08.entity_type = 1
      score_08.entity_id = 8
      score_08.daode = params["daode_08"]
      score_08.zhiye = params["zhiye_08"]
      score_08.zhixing = params["zhixing_08"]
      score_08.xuexi = params["xuexi_08"]
      score_08.chuangxin = params["chuangxin_08"]
      score_08.goutong = params["goutong_08"]
      score_08.license_id = license.first.id
      score_08.created_at = Time.now
      score_08.updated_at = Time.now
      score_08.save
      score_09 = Score.new
      score_09.entity_type = 1
      score_09.entity_id = 9
      score_09.daode = params["daode_09"]
      score_09.zhiye = params["zhiye_09"]
      score_09.zhixing = params["zhixing_09"]
      score_09.xuexi = params["xuexi_09"]
      score_09.chuangxin = params["chuangxin_09"]
      score_09.goutong = params["goutong_09"]
      score_09.license_id = license.first.id
      score_09.created_at = Time.now
      score_09.updated_at = Time.now
      score_09.save
      score_10 = Score.new
      score_10.entity_type = 1
      score_10.entity_id = 10
      score_10.daode = params["daode_10"]
      score_10.zhiye = params["zhiye_10"]
      score_10.zhixing = params["zhixing_10"]
      score_10.xuexi = params["xuexi_10"]
      score_10.chuangxin = params["chuangxin_10"]
      score_10.goutong = params["goutong_10"]
      score_10.license_id = license.first.id
      score_10.created_at = Time.now
      score_10.updated_at = Time.now
      score_10.save
      score_24 = Score.new
      score_24.entity_type = 1
      score_24.entity_id = 24
      score_24.daode = params["daode_24"]
      score_24.zhiye = params["zhiye_24"]
      score_24.zhixing = params["zhixing_24"]
      score_24.xuexi = params["xuexi_24"]
      score_24.chuangxin = params["chuangxin_24"]
      score_24.goutong = params["goutong_24"]
      score_24.license_id = license.first.id
      score_24.created_at = Time.now
      score_24.updated_at = Time.now
      score_24.save 
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score7
    ####投资发展部4个中层给中层打分
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_06 = Score.new
      score_06.entity_type = 1
      score_06.entity_id = 6
      score_06.daode = params["daode_06"]
      score_06.zhiye = params["zhiye_06"]
      score_06.zhixing = params["zhixing_06"]
      score_06.xuexi = params["xuexi_06"]
      score_06.chuangxin = params["chuangxin_06"]
      score_06.goutong = params["goutong_06"]
      score_06.license_id = license.first.id
      score_06.created_at = Time.now
      score_06.updated_at = Time.now
      score_06.save
      score_07 = Score.new
      score_07.entity_type = 1
      score_07.entity_id = 7
      score_07.daode = params["daode_07"]
      score_07.zhiye = params["zhiye_07"]
      score_07.zhixing = params["zhixing_07"]
      score_07.xuexi = params["xuexi_07"]
      score_07.chuangxin = params["chuangxin_07"]
      score_07.goutong = params["goutong_07"]
      score_07.license_id = license.first.id
      score_07.created_at = Time.now
      score_07.updated_at = Time.now
      score_07.save
      score_08 = Score.new
      score_08.entity_type = 1
      score_08.entity_id = 8
      score_08.daode = params["daode_08"]
      score_08.zhiye = params["zhiye_08"]
      score_08.zhixing = params["zhixing_08"]
      score_08.xuexi = params["xuexi_08"]
      score_08.chuangxin = params["chuangxin_08"]
      score_08.goutong = params["goutong_08"]
      score_08.license_id = license.first.id
      score_08.created_at = Time.now
      score_08.updated_at = Time.now
      score_08.save
      score_09 = Score.new
      score_09.entity_type = 1
      score_09.entity_id = 9
      score_09.daode = params["daode_09"]
      score_09.zhiye = params["zhiye_09"]
      score_09.zhixing = params["zhixing_09"]
      score_09.xuexi = params["xuexi_09"]
      score_09.chuangxin = params["chuangxin_09"]
      score_09.goutong = params["goutong_09"]
      score_09.license_id = license.first.id
      score_09.created_at = Time.now
      score_09.updated_at = Time.now
      score_09.save
      score_10 = Score.new
      score_10.entity_type = 1
      score_10.entity_id = 10
      score_10.daode = params["daode_10"]
      score_10.zhiye = params["zhiye_10"]
      score_10.zhixing = params["zhixing_10"]
      score_10.xuexi = params["xuexi_10"]
      score_10.chuangxin = params["chuangxin_10"]
      score_10.goutong = params["goutong_10"]
      score_10.license_id = license.first.id
      score_10.created_at = Time.now
      score_10.updated_at = Time.now
      score_10.save
      score_24 = Score.new
      score_24.entity_type = 1
      score_24.entity_id = 24
      score_24.daode = params["daode_24"]
      score_24.zhiye = params["zhiye_24"]
      score_24.zhixing = params["zhixing_24"]
      score_24.xuexi = params["xuexi_24"]
      score_24.chuangxin = params["chuangxin_24"]
      score_24.goutong = params["goutong_24"]
      score_24.license_id = license.first.id
      score_24.created_at = Time.now
      score_24.updated_at = Time.now
      score_24.save 
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score9
    
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_06 = Score.new
      score_06.entity_type = 1
      score_06.entity_id = 6
      score_06.daode = params["daode_06"]
      score_06.zhiye = params["zhiye_06"]
      score_06.zhixing = params["zhixing_06"]
      score_06.xuexi = params["xuexi_06"]
      score_06.chuangxin = params["chuangxin_06"]
      score_06.goutong = params["goutong_06"]
      score_06.license_id = license.first.id
      score_06.created_at = Time.now
      score_06.updated_at = Time.now
      score_06.save
      score_07 = Score.new
      score_07.entity_type = 1
      score_07.entity_id = 7
      score_07.daode = params["daode_07"]
      score_07.zhiye = params["zhiye_07"]
      score_07.zhixing = params["zhixing_07"]
      score_07.xuexi = params["xuexi_07"]
      score_07.chuangxin = params["chuangxin_07"]
      score_07.goutong = params["goutong_07"]
      score_07.license_id = license.first.id
      score_07.created_at = Time.now
      score_07.updated_at = Time.now
      score_07.save
      score_08 = Score.new
      score_08.entity_type = 1
      score_08.entity_id = 8
      score_08.daode = params["daode_08"]
      score_08.zhiye = params["zhiye_08"]
      score_08.zhixing = params["zhixing_08"]
      score_08.xuexi = params["xuexi_08"]
      score_08.chuangxin = params["chuangxin_08"]
      score_08.goutong = params["goutong_08"]
      score_08.license_id = license.first.id
      score_08.created_at = Time.now
      score_08.updated_at = Time.now
      score_08.save
      score_09 = Score.new
      score_09.entity_type = 1
      score_09.entity_id = 9
      score_09.daode = params["daode_09"]
      score_09.zhiye = params["zhiye_09"]
      score_09.zhixing = params["zhixing_09"]
      score_09.xuexi = params["xuexi_09"]
      score_09.chuangxin = params["chuangxin_09"]
      score_09.goutong = params["goutong_09"]
      score_09.license_id = license.first.id
      score_09.created_at = Time.now
      score_09.updated_at = Time.now
      score_09.save
      score_10 = Score.new
      score_10.entity_type = 1
      score_10.entity_id = 10
      score_10.daode = params["daode_10"]
      score_10.zhiye = params["zhiye_10"]
      score_10.zhixing = params["zhixing_10"]
      score_10.xuexi = params["xuexi_10"]
      score_10.chuangxin = params["chuangxin_10"]
      score_10.goutong = params["goutong_10"]
      score_10.license_id = license.first.id
      score_10.created_at = Time.now
      score_10.updated_at = Time.now
      score_10.save
      score_24 = Score.new
      score_24.entity_type = 1
      score_24.entity_id = 24
      score_24.daode = params["daode_24"]
      score_24.zhiye = params["zhiye_24"]
      score_24.zhixing = params["zhixing_24"]
      score_24.xuexi = params["xuexi_24"]
      score_24.chuangxin = params["chuangxin_24"]
      score_24.goutong = params["goutong_24"]
      score_24.license_id = license.first.id
      score_24.created_at = Time.now
      score_24.updated_at = Time.now
      score_24.save 
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score11
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_01 = Score.new
      score_01.entity_type = 1
      score_01.entity_id = 1
      score_01.daode = params["daode_01"]
      score_01.zhiye = params["zhiye_01"]
      score_01.zhixing = params["zhixing_01"]
      score_01.xuexi = params["xuexi_01"]
      score_01.chuangxin = params["chuangxin_01"]
      score_01.goutong = params["goutong_01"]
      score_01.license_id = license.first.id
      score_01.created_at = Time.now
      score_01.updated_at = Time.now
      score_01.save
      score_02 = Score.new
      score_02.entity_type = 1
      score_02.entity_id = 2
      score_02.daode = params["daode_02"]
      score_02.zhiye = params["zhiye_02"]
      score_02.zhixing = params["zhixing_02"]
      score_02.xuexi = params["xuexi_02"]
      score_02.chuangxin = params["chuangxin_02"]
      score_02.goutong = params["goutong_02"]
      score_02.license_id = license.first.id
      score_02.created_at = Time.now
      score_02.updated_at = Time.now
      score_02.save
      score_03 = Score.new
      score_03.entity_type = 1
      score_03.entity_id = 3
      score_03.daode = params["daode_03"]
      score_03.zhiye = params["zhiye_03"]
      score_03.zhixing = params["zhixing_03"]
      score_03.xuexi = params["xuexi_03"]
      score_03.chuangxin = params["chuangxin_03"]
      score_03.goutong = params["goutong_03"]
      score_03.license_id = license.first.id
      score_03.created_at = Time.now
      score_03.updated_at = Time.now
      score_03.save
      score_04 = Score.new
      score_04.entity_type = 1
      score_04.entity_id = 4
      score_04.daode = params["daode_04"]
      score_04.zhiye = params["zhiye_04"]
      score_04.zhixing = params["zhixing_04"]
      score_04.xuexi = params["xuexi_04"]
      score_04.chuangxin = params["chuangxin_04"]
      score_04.goutong = params["goutong_04"]
      score_04.license_id = license.first.id
      score_04.created_at = Time.now
      score_04.updated_at = Time.now
      score_04.save
      score_05 = Score.new
      score_05.entity_type = 1
      score_05.entity_id = 5
      score_05.daode = params["daode_05"]
      score_05.zhiye = params["zhiye_05"]
      score_05.zhixing = params["zhixing_05"]
      score_05.xuexi = params["xuexi_05"]
      score_05.chuangxin = params["chuangxin_05"]
      score_05.goutong = params["goutong_05"]
      score_05.license_id = license.first.id
      score_05.created_at = Time.now
      score_05.updated_at = Time.now
      score_05.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score12
    ####投资发展部4个中层给一般员工打分
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_24 = Score.new
      score_24.entity_type = 1
      score_24.entity_id = 24
      score_24.daode = params["daode_24"]
      score_24.zhiye = params["zhiye_24"]
      score_24.zhixing = params["zhixing_24"]
      score_24.xuexi = params["xuexi_24"]
      score_24.chuangxin = params["chuangxin_24"]
      score_24.goutong = params["goutong_24"]
      score_24.license_id = license.first.id
      score_24.created_at = Time.now
      score_24.updated_at = Time.now
      score_24.save
      score_25 = Score.new
      score_25.entity_type = 1
      score_25.entity_id = 25
      score_25.daode = params["daode_25"]
      score_25.zhiye = params["zhiye_25"]
      score_25.zhixing = params["zhixing_25"]
      score_25.xuexi = params["xuexi_25"]
      score_25.chuangxin = params["chuangxin_25"]
      score_25.goutong = params["goutong_25"]
      score_25.license_id = license.first.id
      score_25.created_at = Time.now
      score_25.updated_at = Time.now
      score_25.save
      score_26 = Score.new
      score_26.entity_type = 1
      score_26.entity_id = 26
      score_26.daode = params["daode_26"]
      score_26.zhiye = params["zhiye_26"]
      score_26.zhixing = params["zhixing_26"]
      score_26.xuexi = params["xuexi_26"]
      score_26.chuangxin = params["chuangxin_26"]
      score_26.goutong = params["goutong_26"]
      score_26.license_id = license.first.id
      score_26.created_at = Time.now
      score_26.updated_at = Time.now
      score_26.save
      score_27 = Score.new
      score_27.entity_type = 1
      score_27.entity_id = 27
      score_27.daode = params["daode_27"]
      score_27.zhiye = params["zhiye_27"]
      score_27.zhixing = params["zhixing_27"]
      score_27.xuexi = params["xuexi_27"]
      score_27.chuangxin = params["chuangxin_27"]
      score_27.goutong = params["goutong_27"]
      score_27.license_id = license.first.id
      score_27.created_at = Time.now
      score_27.updated_at = Time.now
      score_27.save
      score_28 = Score.new
      score_28.entity_type = 1
      score_28.entity_id = 28
      score_28.daode = params["daode_28"]
      score_28.zhiye = params["zhiye_28"]
      score_28.zhixing = params["zhixing_28"]
      score_28.xuexi = params["xuexi_28"]
      score_28.chuangxin = params["chuangxin_28"]
      score_28.goutong = params["goutong_28"]
      score_28.license_id = license.first.id
      score_28.created_at = Time.now
      score_28.updated_at = Time.now
      score_28.save
      score_29 = Score.new
      score_29.entity_type = 1
      score_29.entity_id = 29
      score_29.daode = params["daode_29"]
      score_29.zhiye = params["zhiye_29"]
      score_29.zhixing = params["zhixing_29"]
      score_29.xuexi = params["xuexi_29"]
      score_29.chuangxin = params["chuangxin_29"]
      score_29.goutong = params["goutong_29"]
      score_29.license_id = license.first.id
      score_29.created_at = Time.now
      score_29.updated_at = Time.now
      score_29.save
      score_30 = Score.new
      score_30.entity_type = 1
      score_30.entity_id = 30
      score_30.daode = params["daode_30"]
      score_30.zhiye = params["zhiye_30"]
      score_30.zhixing = params["zhixing_30"]
      score_30.xuexi = params["xuexi_30"]
      score_30.chuangxin = params["chuangxin_30"]
      score_30.goutong = params["goutong_30"]
      score_30.license_id = license.first.id
      score_30.created_at = Time.now
      score_30.updated_at = Time.now
      score_30.save
      score_31 = Score.new
      score_31.entity_type = 1
      score_31.entity_id = 31
      score_31.daode = params["daode_31"]
      score_31.zhiye = params["zhiye_31"]
      score_31.zhixing = params["zhixing_31"]
      score_31.xuexi = params["xuexi_31"]
      score_31.chuangxin = params["chuangxin_31"]
      score_31.goutong = params["goutong_31"]
      score_31.license_id = license.first.id
      score_31.created_at = Time.now
      score_31.updated_at = Time.now
      score_31.save
      score_32 = Score.new
      score_32.entity_type = 1
      score_32.entity_id = 32
      score_32.daode = params["daode_32"]
      score_32.zhiye = params["zhiye_32"]
      score_32.zhixing = params["zhixing_32"]
      score_32.xuexi = params["xuexi_32"]
      score_32.chuangxin = params["chuangxin_32"]
      score_32.goutong = params["goutong_32"]
      score_32.license_id = license.first.id
      score_32.created_at = Time.now
      score_32.updated_at = Time.now
      score_32.save
      score_33 = Score.new
      score_33.entity_type = 1
      score_33.entity_id = 33
      score_33.daode = params["daode_33"]
      score_33.zhiye = params["zhiye_33"]
      score_33.zhixing = params["zhixing_33"]
      score_33.xuexi = params["xuexi_33"]
      score_33.chuangxin = params["chuangxin_33"]
      score_33.goutong = params["goutong_33"]
      score_33.license_id = license.first.id
      score_33.created_at = Time.now
      score_33.updated_at = Time.now
      score_33.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score13
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_01 = Score.new
      score_01.entity_type = 1
      score_01.entity_id = 1
      score_01.daode = params["daode_01"]
      score_01.zhiye = params["zhiye_01"]
      score_01.zhixing = params["zhixing_01"]
      score_01.xuexi = params["xuexi_01"]
      score_01.chuangxin = params["chuangxin_01"]
      score_01.goutong = params["goutong_01"]
      score_01.license_id = license.first.id
      score_01.created_at = Time.now
      score_01.updated_at = Time.now
      score_01.save
      score_02 = Score.new
      score_02.entity_type = 1
      score_02.entity_id = 2
      score_02.daode = params["daode_02"]
      score_02.zhiye = params["zhiye_02"]
      score_02.zhixing = params["zhixing_02"]
      score_02.xuexi = params["xuexi_02"]
      score_02.chuangxin = params["chuangxin_02"]
      score_02.goutong = params["goutong_02"]
      score_02.license_id = license.first.id
      score_02.created_at = Time.now
      score_02.updated_at = Time.now
      score_02.save
      score_03 = Score.new
      score_03.entity_type = 1
      score_03.entity_id = 3
      score_03.daode = params["daode_03"]
      score_03.zhiye = params["zhiye_03"]
      score_03.zhixing = params["zhixing_03"]
      score_03.xuexi = params["xuexi_03"]
      score_03.chuangxin = params["chuangxin_03"]
      score_03.goutong = params["goutong_03"]
      score_03.license_id = license.first.id
      score_03.created_at = Time.now
      score_03.updated_at = Time.now
      score_03.save
      score_04 = Score.new
      score_04.entity_type = 1
      score_04.entity_id = 4
      score_04.daode = params["daode_04"]
      score_04.zhiye = params["zhiye_04"]
      score_04.zhixing = params["zhixing_04"]
      score_04.xuexi = params["xuexi_04"]
      score_04.chuangxin = params["chuangxin_04"]
      score_04.goutong = params["goutong_04"]
      score_04.license_id = license.first.id
      score_04.created_at = Time.now
      score_04.updated_at = Time.now
      score_04.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score16
    ####投资发展部4个中层给一般员工打分
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_25 = Score.new
      score_25.entity_type = 1
      score_25.entity_id = 25
      score_25.daode = params["daode_25"]
      score_25.zhiye = params["zhiye_25"]
      score_25.zhixing = params["zhixing_25"]
      score_25.xuexi = params["xuexi_25"]
      score_25.chuangxin = params["chuangxin_25"]
      score_25.goutong = params["goutong_25"]
      score_25.license_id = license.first.id
      score_25.created_at = Time.now
      score_25.updated_at = Time.now
      score_25.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def save_employee_score17
    license = License.where("content = ? and is_used = 0", params["license_key"])
    if license.empty?
      @msg = "密码条已使用或无效密码条"
      redirect_to scores_url, notice: '密码条已使用或无效密码条'
    else
      score_01 = Score.new
      score_01.entity_type = 1
      score_01.entity_id = 1
      score_01.daode = params["daode_01"]
      score_01.zhiye = params["zhiye_01"]
      score_01.zhixing = params["zhixing_01"]
      score_01.xuexi = params["xuexi_01"]
      score_01.chuangxin = params["chuangxin_01"]
      score_01.goutong = params["goutong_01"]
      score_01.license_id = license.first.id
      score_01.created_at = Time.now
      score_01.updated_at = Time.now
      score_01.save
      score_02 = Score.new
      score_02.entity_type = 1
      score_02.entity_id = 2
      score_02.daode = params["daode_02"]
      score_02.zhiye = params["zhiye_02"]
      score_02.zhixing = params["zhixing_02"]
      score_02.xuexi = params["xuexi_02"]
      score_02.chuangxin = params["chuangxin_02"]
      score_02.goutong = params["goutong_02"]
      score_02.license_id = license.first.id
      score_02.created_at = Time.now
      score_02.updated_at = Time.now
      score_02.save
      score_03 = Score.new
      score_03.entity_type = 1
      score_03.entity_id = 3
      score_03.daode = params["daode_03"]
      score_03.zhiye = params["zhiye_03"]
      score_03.zhixing = params["zhixing_03"]
      score_03.xuexi = params["xuexi_03"]
      score_03.chuangxin = params["chuangxin_03"]
      score_03.goutong = params["goutong_03"]
      score_03.license_id = license.first.id
      score_03.created_at = Time.now
      score_03.updated_at = Time.now
      score_03.save
      score_04 = Score.new
      score_04.entity_type = 1
      score_04.entity_id = 4
      score_04.daode = params["daode_04"]
      score_04.zhiye = params["zhiye_04"]
      score_04.zhixing = params["zhixing_04"]
      score_04.xuexi = params["xuexi_04"]
      score_04.chuangxin = params["chuangxin_04"]
      score_04.goutong = params["goutong_04"]
      score_04.license_id = license.first.id
      score_04.created_at = Time.now
      score_04.updated_at = Time.now
      score_04.save
      license.first.is_used = 1
      license.first.save
      redirect_to success_scores_url
    end
  end
  def get_success
    render "success", layout: false
  end
end
